﻿using IotClientApp.Server.Services;
using IotClientApp.Shared;
using Microsoft.AspNetCore.Mvc;

namespace IotClientApp.Server.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class DeviceConfigController : ControllerBase
    {
        private readonly IDeviceConfigService _deviceConfigService;
        public DeviceConfigController(IDeviceConfigService deviceConfigService)
        {
            _deviceConfigService = deviceConfigService;
        }
        /// <summary>
        /// 获取所有设备
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageResponse<DeviceConfigInfoModel>> GetDeviceConfigInfos(GetDeviceConfigInfoModel input)
        {
            return await _deviceConfigService.GetDeviceConfigInfos(input);
        }
        /// <summary>
        /// 通信配置编辑
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<string>> SaveDeviceConfigInfo(DeviceConfigInfoModel input)
        {
            return await _deviceConfigService.SaveDeviceConfigInfo(input);
        }
    }
}